<?php

namespace App\Repositories;

use App\User;

class UserRepository
{
    /**
     * Get all of the tasks for a given user.
     *
     * @param  User  $user
     * @return Collection
     */
    public function getAll()
    {
        return User::orderBy('created_at', 'desc')
                    ->get();
    }

    public function getByPhone($mobile_phone)
    {
        return User::where('mobile_phone', $mobile_phone)->first();
    }

    public function getByOpenid($openid)
    {
        return User::where('openid', $openid)->first();
    }
}
